# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, render_template
from flask_restful import Api, Resource, reqparse

import os
import sys

sys.path.append(os.path.dirname(sys.path[0]))

app = Flask(__name__)
api = Api(app)

parser = reqparse.RequestParser()
parser.add_argument('location', type=str, required=False)
parser.add_argument('detect_time', type=str, required=False)
parser.add_argument('video_source', type=str, required=False)
parser.add_argument('business_hours', type=str, required=False)
app.config['JSON_SORT_KEYS'] = False


@app.route('/config')
def get_config():

    dataInfo = [
        {
            "rtsp": "/home/hm/monitor/无人值守视频/1号窗口.mp4",
            "area": "视频监控区域（办公区1）",
            "cameraNum": 1
        },
        {
            "rtsp": "/home/hm/monitor/无人值守视频/2号窗口.mp4",
            "area": "视频监控区域（办公区2）",
            "cameraNum": 2
        },
        {
            "rtsp": "/home/hm/monitor/无人值守视频/3号窗口.mp4",
            "area": "视频监控区域（办公区3）",
            "cameraNum": 3
        },
    ]

    return jsonify(success=True, msg="获取数据成功",
                   dataInfo=dataInfo
                   )


@app.route('/date')
def get_date():
    return jsonify(code="10000", data=0)


if __name__ == '__main__':
    app.run(debug=True, port=5000)
